<template>
	<view class="a">
		<view class="b">
			<input class="c" type="text" v-model="username" placeholder="请输入校园卡号" />
			<input class="c" type="password" v-model="password" placeholder="请输入密码" />
			<button  class="d" @click="dl()">登录</button>
			<button  class="d" @click="fanhui()">返回首页</button>
			<!-- <button  class="d" @click="click03()">去注册</button> -->
			<!-- <button  class="d" @click="xx()">233</button> -->
			<!-- <view class="e">~{{cookie}}~</view> -->
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				username: '',
				password: '',
				code:'',
				msg:"",
				cookie:getApp().globalData.my_cookie,
			};
		},
		methods: {
			dl() {
				uni.showLoading({
				    title: '登录中...'
				});
				uni.request({

					url:'https://cyonline.lzu.edu.cn/theback/core/loginDebug',
					//url:'http://127.0.0.1:8200/core/loginDebug',
					
					data:{
						username:this.username,
						password:this.password
					},
					method:"POST",
					header: {
						'Content-Type': 'application/x-www-form-urlencoded'
					},
					success:(res)=>{
						//console.log(res.data)
						//console.log(res.data[1].JSESSIONID);
						getApp().globalData.my_cookie=res.data[1].JSESSIONID;
						this.cookie=getApp().globalData.my_cookie;
						uni.navigateTo({
							url: '/pages/sclassroom/sclassroom'
						});
						
					},
					complete: () => {
						uni.hideLoading();
					}
				});
			},
			xx(){
				this.msg="66666"
			},
			click03(){
				console.log(2233)
				uni.navigateTo({
					url: '/pages/signup'
				})
			},
			fanhui()
			{
				uni.navigateTo({
					url: '/pages/index'
				})
			},
		},
	};
</script>
<style>
.a{
	display: flex;
	justify-content: center;
	align-items: center;
	height: 100vh;
	flex-direction: column;
	background: url('/static/01.png');
	background-size: cover;
}
.b{
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	width: 80vw;
	height: 300px;
	background: rgb(200, 200, 200,0.35);
	border-radius: 10px;
	/* border: gray 1px solid; */
}
.c{
	display: flex;
	margin-bottom: 20px;
	background: rgb(255,255,255);
	border-radius: 5px;
	/* border: gray 1px solid; */
	font-size: 12px;
	height: 30px;
	width: 70%;
}
.d{
	height: 30px;
	width: 70%;
	margin-bottom: 20px;
	font-size: 12px;
}
.e{
	font-size: 10px;
	height: 30px;
	width: 70%;
	
	
}
</style>